﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Web_Linkus : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CmsDataContext db = new CmsDataContext();
            var train = (from aT in db.Train
                         where (aT.Started - DateTime.Now).Days >= 0
                         orderby aT.Registed descending
                         select new
                         {
                             ID = aT.ID,
                             Memo = string.Format("{0}将于{1:yyyy年MM月dd日}在{2}举办", aT.Name, aT.Started, aT.Address)
                         }).Take(6);
            Trains.DataSource = train;
            Trains.DataBind();

            var px2 = (from aA in db.Article where aA.Verified != null orderby aA.Verified descending select aA).Take(6);
            Repeater3.DataSource = px2;
            Repeater3.DataBind();
        }
    }
}